<?php  
echo $this->session->flash(); 
if(!empty($payableList)){
    $this->Paginator->options(array(
        'update' => '#payable_listing',
        'evalScripts' => true, 
        //'url' => array('controller' => 'Reports', 'action' => 'checkPayable')
    ));
} 
?>
<div style="text-align: left; font-weight: bold; padding: 5px 0;"><?php echo $textLabel;?> &nbsp;&nbsp;&nbsp;<?php //echo __('MPF'). ' : '.$mpfLabel ?></div>
<div class="file" id="List">
    <table width="100%" border="0" cellspacing="1" cellpadding="2" class="list">
        <tr class="heading"  bgcolor="#708089">
            <th width="6%" valign="top" align="left"><?php echo __('S.NO') ?></th>
            <th valign="top"  align="left"><?php echo  __('ENG_NAME', true); ?></th>
            <th valign="top"  align ="left"><?php echo __('PAYEE_ID_PROOF_NO', true); ?></th>
            <th valign="top"  align ="left"><?php echo __('COUNT', true); ?></th>
        </tr>
        <?php
        if (isset($payableList) && count($payableList) > 0) {
            $i = 0;
            foreach ($payableList as $arrayDetail) {
                ?>
                <tr class="<?php echo (($i%2) == 0)? 'even' : 'odd';?>">
                    <td>&nbsp;<?php echo $i + 1 ?></td>
                    <td><?php
                        echo $this->Js->link(
                                $arrayDetail['Payee']['eng_name'], 
                                array(
                                    'controller' => 'reports',
                                    'action' => 'view_details',$arrayDetail['Payee']['id'], $switch
                                ), 
                                array(
                                    'update' => '#detailDiv',
                                    'alt' => __('DETAILS', true),
                                    'title' => __('DETAILS', true),
                                    'escape'=>false,
                                    'before' => $this->Js->get('#detailDiv')->effect('fadeOut'),
                                    'success' => $this->Js->get('#detailDiv')->effect('fadeIn'),
                                    'style' => 'color:#e18f00; font-weight:bold; text-decoration: underline;'
                                )
                            );
                        ?>
                    </td>
                    <td>&nbsp;<?php echo $arrayDetail['Payable']['payee_id_proof_no']; ?></td>
                    <td>&nbsp;<?php echo isset($arrayDetail['Payable']['count']) ? $arrayDetail['Payable']['count']. ' ' .__('ITEM_FOUND') : '--';?> </td>
                </tr>  
                <?php
                $i++;
            }
        }
        ?>
        <tr>
            <td colspan="12" bgcolor="#ffffff" align="center">
                <div class="pagination">            
                    <?php
                    if (!empty($payableList)) {
                        echo $this->Element('pagination_reports');
                    } else {
                        echo __("NO_RECORD_MESSAGE");
                    }
                    ?>              
                </div>
            </td>
        </tr>
    </table>
</div>


<!-- print section -->
<div style="margin: 10px 0 10px 0;">
    <div style="float: left;">
        <?php echo $this->Form->create("Report", array('action' => 'download_report')); ?>
        <div style="float: right; margin-left: 20px; margin-right: 6px;"><?php 
            echo $this->Form->hidden('Report.year', array('value' => $Year, 'type' => 'textfield'));
            echo $this->Form->hidden('Report.month', array('value' => $Month, 'type' => 'textfield'));
            echo $this->Form->hidden('Report.mpf', array('value' => $mpf, 'type' => 'textfield'));
            echo $this->Form->hidden('Report.switch', array('value' => '1'.$switch, 'type' => 'textfield'));
            echo $this->Form->submit(__('PRINT_TO_PDF', true), array(
                "class" => "button", 
                'label' => false, 
                'div' => false,
                'name' => 'print_pdf'
            ));
            echo '<div class="buttonEnding"></div>';
            ?>
        </div>
        <div style="float: right;"><?php 
            echo $this->Form->submit(__('PRINT_TO_EXCEL', true), array(
                "class" => "button", 
                'label' => false, 
                'div' => false,
                'name' => 'print_excel'
            ));
            echo '<div class="buttonEnding"></div>';?>
        </div>
        <?php echo $this->Form->end(); ?>
        <div style="clear: right;"></div>
    </div>
    <div style="clear: left;"></div>
</div>

<div id="detailDiv" style="margin-top:17px;"></div>
        <!-- Div update ends here -->
<?php echo $this->Js->writeBuffer();?>